/**
 * creation: 14-mrt-2008
 */
package org.jfonia.connect.logic;

import org.jfonia.connect.BasicNode;
import org.jfonia.connect.Value;

/**
 * @author wijnand.schepens@gmail.com
 *
 */
public class ConditionalValue<T> extends BasicNode implements Value<T>
{
	protected Value<Boolean> condition;
	protected Value<T>       thenValue;
	protected Value<T>       elseValue;

	
	
	public ConditionalValue(Value<Boolean> condition, Value<T> thenValue, Value<T> elseValue)
	{
		super();
		// TODO Auto-generated constructor stub
		this.condition = condition;
		this.thenValue = thenValue;
		this.elseValue = elseValue;
	}



	public T get()
	{
		return condition.get() ? thenValue.get() : elseValue.get();
	}
	
	
}
